package com.atmilan.quartz.constant.enums;

import com.github.pagehelper.util.StringUtil;

/**
 *
 * 供应商id枚举
 *
 *  2是易时尚
 *  21是巴黎春天
 *  42是Muse
 *  37, 136 是创蓝
 *
 * @author Howe Hsiang
 * @date 2020/12/01 19:59
 */
public enum SuppliersIdEnum {

    EASY_FASHION("2","易时尚"),
    PARIS_SPRING("21","巴黎春天"),
    Muse("42","Muse"),
    CHUANG_LAN("37","创蓝"),
    CHUANG_LAN_P("136","创蓝"),
    OTHER("0","其他"),
    UNKNOWN("","");

    String code;
    String value;

    public String getCode() {
        return code;
    }
    public String getValue() {
        return value;
    }

    SuppliersIdEnum(String code, String value){
        this.code = code;
        this.value = value;
    }

    /**
     * 根据code得到枚举的Value
     *
     * @param code
     * @return
     */
    public static String getEnumValue(String code) {
        if (StringUtil.isEmpty(code)){
            return SuppliersIdEnum.UNKNOWN.getValue();
        }
        SuppliersIdEnum[] suppliersIdEnums = SuppliersIdEnum.values();
        for (SuppliersIdEnum suppliersIdEs : suppliersIdEnums) {
            if ((code).equals(suppliersIdEs.getCode())) {
                return suppliersIdEs.getValue();
            }
        }
        return SuppliersIdEnum.OTHER.getValue();
    }

}
